<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="审核状态">
              <j-dict-select-tag placeholder="请选择审核状态" v-model="queryParam.status" dictCode="audit_status"/>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="ID">
              <a-input placeholder="ID" v-model="queryParam.userId"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="昵称">
              <a-input placeholder="请输入昵称" v-model="queryParam.userName"></a-input>
            </a-form-item>
          </a-col>

          <template v-if="toggleSearchStatus">
            <a-col :xl="10" :lg="11" :md="12" :sm="24">
              <a-form-item label="申请时间">
                <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.createTime_begin"></j-date>
                <span class="query-group-split-cust"></span>
                <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.createTime_end"></j-date>
              </a-form-item>
            </a-col>
          </template>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange">

        <template slot="statusSlot" slot-scope="text, record">
          <div v-if="record.status === '1'" style="color: #169bd5">{{text}}</div>
          <div v-else-if="record.status === '2'" style="color: #000000">{{text}}</div>
          <div v-else style="color: red">{{text}}</div>
        </template>
        <template slot="imgSlot" slot-scope="text,record">
          <img :src="text" :preview="record.id" height="30px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="audioSlot" slot-scope="text,record">
          <audio ref="audioPlayer" controls>
            <source :src="text" type="audio/aac">
          </audio>

<!--          <audio ref="audioPlayer" :src="text" style="height: 40px" controls></audio>-->
        </template>
      </a-table>
    </div>
  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'

  export default {
    name: 'AccostWomanList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
    },
    data () {
      return {
        description: '搭讪语设置-女用户管理页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'ID',
            align:"center",
            dataIndex: 'userId'
          },
          {
            title:'用户昵称',
            align:"center",
            dataIndex: 'userName'
          },
          {
            title:'模版名称',
            align:"center",
            dataIndex: 'tempName'
          },
          {
            title:'搭讪语',
            align:"center",
            dataIndex: 'tempText'
          },
          {
            title:'图片',
            align:"center",
            dataIndex: 'tempImg',
            scopedSlots: { customRender: 'imgSlot' }
          },
          {
            title:'语音',
            align:"center",
            dataIndex: 'voiceUrl',
            scopedSlots: { customRender: 'audioSlot' }
          },
          {
            title:'状态',
            align:"center",
            dataIndex: 'status_dictText',
            scopedSlots: { customRender: 'statusSlot' }
          },
          {
            title:'申请时间',
            align:"center",
            dataIndex: 'createTime'
          }
        ],
        url: {
          list: "/user/userAccostWoman/list",
        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      initDictConfig(){
      },
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>